﻿using System;
using System.Collections.Generic;
using System.Text;
using DaiKin.DBDataAccessLib.Helper;
using System.Data;
using System.Data.Common;

namespace DBDataAccessLib
{
    public abstract class DBCommonAccess
    {
        public static List<string> GetAllDBNames(string connectionString)
        {
            List<string> dbNames = new List<string>();
            DbDataReader reader = null;
            if (DBHelperFactory.DbName == DBType.Oracle)
                reader = OracleHelper.ExecuteReader(
                    connectionString,
                    CommandType.Text,
                    SqlProvider.SelectAllDBNames);
            else reader = SqlHelper.ExecuteReader(
                    connectionString,
                    CommandType.Text,
                    SqlProvider.SelectAllDBNames);
            while (reader.Read())
            {
                dbNames.Add(reader.GetString(0));
            }
            return dbNames;
        }
    }
}
